import QtQuick 1.0
import "content"
Rectangle {
    color: "lightgray"
    width: 240
    height: 320

    VisualItemModel {
        id: itemModel


        Rectangle {
            XmlListModel {
                    id: feedModel
                    source: "http://www.google.co.uk/ig/api?weather=taipei"

                    query: "/xml_api_reply/weather"

                    XmlRole { name: "condition"; query: "current_conditions/condition/@data/string()" }
                    XmlRole { name: "temp_c"; query: "current_conditions/temp_c/@data/string()" }
                    XmlRole { name: "humidity"; query: "current_conditions/humidity/@data/string()" }
                    XmlRole { name: "icon"; query: "current_conditions/icon/@data/string()" }
            }
            ListView {
                   id: list
                   model: feedModel
                   delegate: WeatherDelegate {}


               }
            width: view.width; height: view.height
            color: "#FFFEF0"
            //Text { text: "Page 1"; font.bold: true; anchors.centerIn: parent }
        }
        Rectangle {
            XmlListModel {
                    id: feedModel2
                    source: "http://www.google.co.uk/ig/api?weather=taipei"
                    query: "/xml_api_reply/weather/forecast_conditions"

                    XmlRole { name: "day_of_week"; query: "day_of_week/@data/string()" }
                    XmlRole { name: "low"; query: "low/@data/string()" }
                    XmlRole { name: "high"; query: "high/@data/string()" }
                    XmlRole { name: "icon"; query: "icon/@data/string()" }
                    XmlRole { name: "condition"; query: "condition/@data/string()" }

            }
            ListView {
                   id: list2
                   model: feedModel2
                   delegate: WeatherDelegate2 {}


               }
            width: view.width; height: view.height
            color: "#FFFEF0"
            //Text { text: "Page 2"; font.bold: true; anchors.centerIn: parent }
        }
        Rectangle {
            XmlListModel {
                    id: feedModel3
                    source: "http://www.google.co.uk/ig/api?weather=taipei"
                    query: "/xml_api_reply/weather/forecast_conditions"

                    XmlRole { name: "day_of_week"; query: "day_of_week/@data/string()" }
                    XmlRole { name: "low"; query: "low/@data/string()" }
                    XmlRole { name: "high"; query: "high/@data/string()" }
                    XmlRole { name: "icon"; query: "icon/@data/string()" }
                    XmlRole { name: "condition"; query: "condition/@data/string()" }

            }
            ListView {
                   id: list3
                   model: feedModel3
                   delegate: WeatherDelegate3 {}


               }
            width: view.width; height: view.height
            color: "#FFFEF0"
            //Text { text: "Page 3"; font.bold: true; anchors.centerIn: parent }
        }
        Rectangle {
            XmlListModel {
                    id: feedModel4
                    source: "http://www.google.co.uk/ig/api?weather=taipei"
                    query: "/xml_api_reply/weather/forecast_conditions"

                    XmlRole { name: "day_of_week"; query: "day_of_week/@data/string()" }
                    XmlRole { name: "low"; query: "low/@data/string()" }
                    XmlRole { name: "high"; query: "high/@data/string()" }
                    XmlRole { name: "icon"; query: "icon/@data/string()" }
                    XmlRole { name: "condition"; query: "condition/@data/string()" }

            }
            ListView {
                   id: list4
                   model: feedModel4
                   delegate: WeatherDelegate4 {}


               }
            width: view.width; height: view.height
            color: "#FFFEF0"
                   //Text { text: "Page 4"; font.bold: true; anchors.centerIn: parent }
               }
        Rectangle {
            XmlListModel {
                    id: feedModel5
                    source: "http://www.google.co.uk/ig/api?weather=taipei"
                    query: "/xml_api_reply/weather/forecast_conditions"

                    XmlRole { name: "day_of_week"; query: "day_of_week/@data/string()" }
                    XmlRole { name: "low"; query: "low/@data/string()" }
                    XmlRole { name: "high"; query: "high/@data/string()" }
                    XmlRole { name: "icon"; query: "icon/@data/string()" }
                    XmlRole { name: "condition"; query: "condition/@data/string()" }

            }
            ListView {
                   id: list5
                   model: feedModel5
                   delegate: WeatherDelegate5 {}


               }
            width: view.width; height: view.height
            color: "#FFFEF0"
                   //Text { text: "Page 5"; font.bold: true; anchors.centerIn: parent }
               }
    }

    ListView {
        id: view
        anchors { fill: parent; bottomMargin: 30 }
        model: itemModel
        preferredHighlightBegin: 0; preferredHighlightEnd: 0
        highlightRangeMode: ListView.StrictlyEnforceRange
        orientation: ListView.Horizontal
        snapMode: ListView.SnapOneItem; flickDeceleration: 2000
    }

    Rectangle {
        width: view.width; height: 30
        anchors { top: view.bottom; bottom: parent.bottom }
        color: "gray"

        Row {
            anchors.centerIn: parent
            spacing: 20

            Repeater {
                model: itemModel.count

                Rectangle {
                    width: 5; height: 5
                    radius: 3
                    color: view.currentIndex == index ? "blue" : "white"

                    MouseArea {
                        width: 20; height: 20
                        anchors.centerIn: parent
                        onClicked: view.currentIndex = index
                    }
                }
            }
        }
    }
}
